IOMMU: prevent VT-d device IOTLB operations on wrong IOMMU
authorMalcolm Crossley <malcolm.crossley@citrix.com>
Wed, 18 Jun 2014 13:50:02 +0000 (15:50 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 18 Jun 2014 13:50:02 +0000 (15:50 +0200)
commit84c340ba4c3eb99278b6ba885616bb183b88ad67
tree079faa63aa3cac425147a9a42035d13ba5b0c215
parent72eaf29e8d70784aaf066ead79df1295a25ecfd0
IOMMU: prevent VT-d device IOTLB operations on wrong IOMMU

PCIe ATS allows for devices to contain IOTLBs, the VT-d code was iterating
around all ATS capable devices and issuing IOTLB operations for all IOMMUs,
even though each ATS device is only accessible via one particular IOMMU.

Issuing an IOMMU operation to a device not accessible via that IOMMU results
in an IOMMU timeout because the device does not reply. VT-d IOMMU timeouts
result in a Xen panic.

Therefore this bug prevents any Intel system with 2 or more ATS enabled IOMMUs,
each with an ATS device connected to them, from booting Xen.

The patch adds a IOMMU pointer to the ATS device struct so the VT-d code can
ensure it does not issue IOMMU ATS operations on the wrong IOMMU. A void
pointer has to be used because AMD and Intel IOMMU implementations do not have
a common IOMMU structure or indexing mechanism.

Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/amd/pci_amd_iommu.c
xen/drivers/passthrough/ats.h
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/x86/ats.c
xen/drivers/passthrough/x86/ats.c